#
# LuckyBot4, a python IRC bot
# (c) Copyright 2008 by Lucas van Dijk
# http://www.return1.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
#
# $Id: setup.py 33 2009-02-11 21:46:27Z luckyluke56 $
#

from distutils.core import setup
import luckybot
import os
import sys
import fnmatch
import glob

def opj(*args):
	path = os.path.join(*args)
	return os.path.normpath(path)


def find_data_files(srcdir, *wildcards, **kw):
	# get a list of all files under the srcdir matching wildcards,
	# returned in a format to be used for install_data
	def walk_helper(arg, dirname, files):
		if '.svn' in dirname:
			return
		names = []
		lst, wildcards = arg
		for wc in wildcards:
			wc_name = opj(dirname, wc)
			for f in files:
				filename = opj(dirname, f)

				if fnmatch.fnmatch(filename, wc_name) and not os.path.isdir(filename):
					names.append(filename)
		if names:
			lst.append( (dirname, names ) )

	file_list = []
	recursive = kw.get('recursive', True)
	if recursive:
		os.path.walk(srcdir, walk_helper, (file_list, wildcards))
	else:
		walk_helper((file_list, wildcards),
					srcdir,
					[os.path.basename(f) for f in glob.glob(opj(srcdir, '*'))])
	return file_list

files = find_data_files('luckybot/', '*.*')

setup(name = "luckybot",
	version = luckybot.__version__,
	description = "An extendable IRC Bot written in python",
	author = "Lucas van Dijk",
	author_email = "info@lucasvandijk.nl",
	license = "GNU GPLv3",
	url = "http://www.return1.net/site/projects/Lucky-Bot-v4/",
	packages = [
		'luckybot', 
		'luckybot.bot', 
		'luckybot.luckynet', 
		'luckybot.luckynet.connection',
		'luckybot.luckynet.protocols',
		'luckybot.views',
		'luckybot.views.gui'
	],
	
	data_files = files,
	
	scripts = ["run"],
	long_description = """Lucky Bot is a nice IRC Bot easily extended with
	plugins. It supports multiple servers and channels, has a GUI and
	console mode, an authentication system and much more!""",
	
	classifiers = [
		'Development Status :: 3 - Alpha',
		'Environment :: Console',
		'Environment :: X11 Applications :: GTK',
		'Intended Audience :: End Users/Desktop',
		'Intended Audience :: Developers',
		'License :: OSI Approved :: GNU General Public License (GPL)',
		'Operating System :: POSIX :: Linux',
		'Operating System :: Microsoft :: Windows :: Windows NT/2000',
		'Programming Language :: Python',
		'Topic :: Communications :: Chat :: Internet Relay Chat ',
		'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
	]
)
